# -*- coding:utf-8 -*-
# __author__ : "张百科"
# Date: 2021/1/25 14:23
# File: marketing.py
# IDE: PyCharm
from rest_framework import serializers
from models.marketing import Marketing

class MarketingSerializer(serializers.ModelSerializer):
    title = serializers.CharField(label='活动标题', max_length=50, help_text='活动标题',required=True)
    index_image_url=serializers.CharField(label='展示图片路径', max_length=200, help_text='展示图片路径',required=False)
    description=serializers.CharField(label='活动详情', max_length=5000,  help_text='活动详情',required=True)
    start_time = serializers.DateTimeField(label='活动开始时间',help_text='活动开始时间',required=True)
    end_time=serializers.DateTimeField(label='活动截止时间',help_text='活动截止时间',required=True)
    is_enable=serializers.IntegerField(default=1,label='是否展示',help_text='是否展示')
    list_pic_url = serializers.CharField(label='列表图片', help_text='列表图片', required=False)
    read_count = serializers.IntegerField(read_only=True)
    update_time=serializers.DateTimeField(read_only=True)


    class Meta:
        model = Marketing
        exclude = ('is_delete',)